import java.io.*;
import java.net.*;
public class Client {
    public static void main(String[] args) throws IOException {
        Socket sk=new Socket("127.0.0.1",12345);//与服务器连接

        InputStream in=sk.getInputStream();//得到该连接中的流
        OutputStream out= sk.getOutputStream();

        InputStreamReader ir=new InputStreamReader(in);
        OutputStreamWriter ow=new OutputStreamWriter(out);
        BufferedReader br=new BufferedReader(ir);
        BufferedWriter bw=new BufferedWriter(ow);

        bw.write("peter");//输出客户的名字
        bw.newLine();
        bw.flush();

        String s=br.readLine();//接收服务器的回话
        System.out.println(s);

        sk.close();
    }
}
